package cn.jiangjiesheng.bootstrap.commons.entity;


import lombok.Builder;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * Created by dev@jiangjiesheng.cn on 19-11-13.
 */
@Data
@Accessors(chain = true)
@Builder
public class BaseResult {
    //@Builder.Default
    private Boolean success;// = Boolean.TRUE;
    //private Integer errorCode;
    private String message;
    private Object result; //data -> result

    public BaseResult suc() {
        setSuccess(Boolean.TRUE);
        return this;
    }

    public BaseResult fail() {
        setSuccess(Boolean.FALSE);
        return this;
    }

    public BaseResult fail(String errorMsg) {
        setSuccess(Boolean.FALSE).setMessage(errorMsg);
        return this;
    }


    public BaseResult systemError() {
        fail().setMessage("系統异常");
        return this;
    }


}
